package com.lyq;

import com.lyq.mapper.AdminMapper;
import com.lyq.mapper.DepartmentMapper;
import com.lyq.mapper.DoctorMapper;
import com.lyq.mapper.HospitalMapper;
import com.lyq.mapper.OrderMapper;
import com.lyq.mapper.UsersMapper;
import com.lyq.pojo.Admin;
import com.lyq.pojo.Department;
import com.lyq.pojo.Order;
import com.lyq.pojo.Users;
import com.lyq.pojo.VO.DoctorVo;
import com.lyq.pojo.VO.OrderVO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Date;
import java.util.List;

@SpringBootTest
public class test {
    @Autowired
    private HospitalMapper hospitalMapper;
    @Autowired
    private  AdminMapper adminMapper;
    @Autowired
    private UsersMapper usersMapper;
    @Autowired
    private DoctorMapper doctorMapper;
    @Autowired
    private DepartmentMapper departmentMapper;
    @Autowired
    private OrderMapper orderMapper;
    @Test
    public void testUpdate(){
//        Admin admin = new Admin();
//       admin.setAdminName("abc");
//       admin.setAdminPassword("123456");
//       // List<Admin> admins = adminMapper.;
       // admins.forEach(System.out::println);
//        QueryWrapper<Admin> wrapper = new QueryWrapper<>();
//            wrapper.eq("admin_name","admin");
//        Admin selectOne = adminMapper.selectOne(wrapper);
//        System.out.println(selectOne);
    }

    @Test
    public void inseletAdmin(){

        Admin admin = new Admin();
        admin.setAdminName("abc");
        admin.setAdminPassword("1234567");
        admin.setDeleted(0);
        admin.setVersion(1);
        int insert = adminMapper.insert(admin);

        System.out.println(admin);
    }
    @Test
    void selectHospitalById(){

       // Hospital hospital = hospitalMapper.selectById(0);
        List<OrderVO> orderVOS = orderMapper.selectOrderAll();
        System.out.println(orderVOS);
    }
    //@Test
//    void test7(){
//        User user = new User();
//        user.setName("asd22");
//       // user.setEmail("123456");
//        //user.setAge(22);
//        int insert = userMapper.insert(user);
//        System.out.println(insert);
//    }
    @Test
    void test8(){
        // hid-hospital 1-湖南中医药大学第二附属医院,2-中南大学湘雅二医院,3=湖南省肿瘤医院,4-南华大学附属南华医院
        //did-1	内科  2	外科 3	小儿科 4	妇产科 5	眼科6	牙科7	耳鼻喉科8	泌尿科9	皮肤科

//        Doctor doctor = new Doctor();
//        doctor.setDoctorName("潘曼容");
//        doctor.setDoctorDescribe("潘曼容,耳鼻喉科,南华大学附属南华医院");
//        doctor.setDoctorPhoto("http://lyqbysl.natapp1.cc/img/doctor/doctor0.png");
//        doctor.setHid(4);
//        doctor.setDid(87);
//        int insert = doctorMapper.insert(doctor);
        // List<DoctorVo> doctorVos =
        Integer i = 79;
        List<DoctorVo> doctorVos = doctorMapper.SelectDoctorAll();
        System.out.println(doctorVos);

    }
    @Test
    void test9(){

        Department department = departmentMapper.selectById(2);
    }
    @Test
    void test10(){
       Order order=new Order();
       order.setOrderDoId(3);
       order.setOrderTime(new Date());
       order.setDid(1);
       order.setNickName("asd");
       order.setHid(1);
       order.setPhone("1234567");
      order.setOderName("123");


        int insert = orderMapper.insert(order);
        System.out.println(insert);

    }
    @Test
    void test11(){
        List<Users> users = usersMapper.selectList(null);
        System.out.println(users);

    }

}
